#
# A sample ruby script, which performs something impossible in java: extending Array functionalities. 
#

class Array
  # If +number+ is greater than the size of the array, the method
  # will simply return the array itself sorted randomly
  def randomly_pick(number)
    sort_by{ rand }.slice(0...number)
  end
end

logger = com.onjava.util.Logger

arr = [ "a string" , 10 , 3.14 , "another string" , [1,2,3] ]

arr.randomly_pick(2).each do |element| 
	logger.log(element.to_s)
end